package com.wmjsoft.plugins.nutzplugin.dao

import org.nutz.dao.Cnd
import org.nutz.dao.Dao

/**
 * 如果我没有写注释，请提醒我
 * @program: Maternal
 * @description:
 * @author: Mr.Lee
 * @create: 2021-02-20 10:57
 */
object MyDao {

    @JvmStatic
    lateinit var dao: Dao

    private fun initQuerySql(clazz: Class<*>): QueerSql {
        var mySql  = QueerSql(dao)
        mySql.clazz = clazz
        mySql.joinString = StringBuilder()
        mySql.selectString = StringBuilder()
        mySql.cnd = Cnd.NEW()
        return mySql
    }

    fun find(clazz:Class<*>): Selecter {
        return Selecter(initQuerySql(clazz))
    }
    fun inserter(clazz: Class<*>): Inserter {
        return Inserter(initQuerySql(clazz))
    }

    fun updater(clazz: Class<*>): Updater {
        return Updater(initQuerySql(clazz))
    }

    fun deleter(clazz: Class<*>): Deleter {
        return Deleter(initQuerySql(clazz))
    }

}